#[doc = "Register `PERI_PMC29` reader"]
pub struct R(crate::R<PERI_PMC29_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<PERI_PMC29_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<PERI_PMC29_SPEC>> for R {
    fn from(reader: crate::R<PERI_PMC29_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `PERI_PMC29` writer"]
pub struct W(crate::W<PERI_PMC29_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<PERI_PMC29_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::ops::DerefMut for W {
    #[inline(always)]
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl core::convert::From<crate::W<PERI_PMC29_SPEC>> for W {
    fn from(writer: crate::W<PERI_PMC29_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `hpm1_rcc` reader - hpm1_monitor_period."]
pub struct HPM1_RCC_R(crate::FieldReader<u8, u8>);
impl HPM1_RCC_R {
    pub(crate) fn new(bits: u8) -> Self {
        HPM1_RCC_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for HPM1_RCC_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `hpm1_rcc` writer - hpm1_monitor_period."]
pub struct HPM1_RCC_W<'a> {
    w: &'a mut W,
}
impl<'a> HPM1_RCC_W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0xff << 24)) | (((value as u32) & 0xff) << 24);
        self.w
    }
}
#[doc = "Field `hpm1_lowlimit` reader - Lower limit of the HPM1 original code pattern."]
pub struct HPM1_LOWLIMIT_R(crate::FieldReader<u16, u16>);
impl HPM1_LOWLIMIT_R {
    pub(crate) fn new(bits: u16) -> Self {
        HPM1_LOWLIMIT_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for HPM1_LOWLIMIT_R {
    type Target = crate::FieldReader<u16, u16>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `hpm1_lowlimit` writer - Lower limit of the HPM1 original code pattern."]
pub struct HPM1_LOWLIMIT_W<'a> {
    w: &'a mut W,
}
impl<'a> HPM1_LOWLIMIT_W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u16) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x0fff << 12)) | (((value as u32) & 0x0fff) << 12);
        self.w
    }
}
#[doc = "Field `hpm1_uplimit` reader - Upper limit of the HPM1 original code pattern."]
pub struct HPM1_UPLIMIT_R(crate::FieldReader<u16, u16>);
impl HPM1_UPLIMIT_R {
    pub(crate) fn new(bits: u16) -> Self {
        HPM1_UPLIMIT_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for HPM1_UPLIMIT_R {
    type Target = crate::FieldReader<u16, u16>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `hpm1_uplimit` writer - Upper limit of the HPM1 original code pattern."]
pub struct HPM1_UPLIMIT_W<'a> {
    w: &'a mut W,
}
impl<'a> HPM1_UPLIMIT_W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u16) -> &'a mut W {
        self.w.bits = (self.w.bits & !0x03ff) | ((value as u32) & 0x03ff);
        self.w
    }
}
impl R {
    #[doc = "Bits 24:31 - hpm1_monitor_period."]
    #[inline(always)]
    pub fn hpm1_rcc(&self) -> HPM1_RCC_R {
        HPM1_RCC_R::new(((self.bits >> 24) & 0xff) as u8)
    }
    #[doc = "Bits 12:23 - Lower limit of the HPM1 original code pattern."]
    #[inline(always)]
    pub fn hpm1_lowlimit(&self) -> HPM1_LOWLIMIT_R {
        HPM1_LOWLIMIT_R::new(((self.bits >> 12) & 0x0fff) as u16)
    }
    #[doc = "Bits 0:9 - Upper limit of the HPM1 original code pattern."]
    #[inline(always)]
    pub fn hpm1_uplimit(&self) -> HPM1_UPLIMIT_R {
        HPM1_UPLIMIT_R::new((self.bits & 0x03ff) as u16)
    }
}
impl W {
    #[doc = "Bits 24:31 - hpm1_monitor_period."]
    #[inline(always)]
    pub fn hpm1_rcc(&mut self) -> HPM1_RCC_W {
        HPM1_RCC_W { w: self }
    }
    #[doc = "Bits 12:23 - Lower limit of the HPM1 original code pattern."]
    #[inline(always)]
    pub fn hpm1_lowlimit(&mut self) -> HPM1_LOWLIMIT_W {
        HPM1_LOWLIMIT_W { w: self }
    }
    #[doc = "Bits 0:9 - Upper limit of the HPM1 original code pattern."]
    #[inline(always)]
    pub fn hpm1_uplimit(&mut self) -> HPM1_UPLIMIT_W {
        HPM1_UPLIMIT_W { w: self }
    }
    #[doc = "Writes raw bits to the register."]
    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "PERI_PMC29 is the HPM1 original code pattern threshold configuration register.\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [peri_pmc29](index.html) module"]
pub struct PERI_PMC29_SPEC;
impl crate::RegisterSpec for PERI_PMC29_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [peri_pmc29::R](R) reader structure"]
impl crate::Readable for PERI_PMC29_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [peri_pmc29::W](W) writer structure"]
impl crate::Writable for PERI_PMC29_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets PERI_PMC29 to value 0x0100_0000"]
impl crate::Resettable for PERI_PMC29_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0x0100_0000
    }
}
